/** 
 * @CopyRight (c) 2012-2012
 * @Project <jtao>
 * @JDK_Version_Used:<JDK1.6>
 * @Description:TODO<描述用途>
 * @Title: AdminWeb.java
 * @Author: <何俊>
 * @Author_of_Contact <E:azj1001@sina.com T:18651831939>
 * @Date 2012-11-10 下午5:07:37
 * @Modified_By: <修改人>
 * @Modified_of_Contact <修改人联系方式>
 * @Modified_Date <修改日期时间>
 * @Why & What is modified <修改原因描述>
 * @Version v1.00
 */
package com.e.buy.web.admin;

import org.springframework.stereotype.Controller;

import com.e.buy.BuyTools;

/**
 * @Description:TODO(描述类别作用)
 * @author <何俊>
 * @date 2012-11-10 下午5:07:37
 * @version v1.0
 * @Other :@see #Files
 */
@Controller
//@RequestMapping("/admin")
public class AdminWeb extends BuyTools {

//	@ResponseBody
//	@RequestMapping("/check_account.ajax")
//	public String checkAccount(@RequestParam("u") String u) {
//		String res = "0";
//		try {
//			res = service.getSql("sql", "member.total");
//			List<ConditionBean> beans = new ArrayList<ConditionBean>();
//			beans.add(new ConditionBean("uname", "=", "?", u, "m"));
//			res = (String) service.queryForObject(res, String.class, beans);
//		} catch (Exception e) {
//			e.printStackTrace();
//			res = "1";
//		}
//		return res;
//	}
//
//	@ResponseBody
//	@RequestMapping("/doRegister.ajax")
//	public String doRegister(@RequestParam("u") String u, @RequestParam("p") String p, @RequestParam("e") String e,
//			@RequestParam("v") String v,HttpSession session) {
//		JSONObject json = new JSONObject();
//		String res = "0";
//		try {
//			//验证码
//			String vcode = (String) session.getAttribute("vcode");
//			if(!vcode.equalsIgnoreCase(v)){
//				json.element("error","0");
//				json.element("msg", this.getWebProperties("web", "user.register.error.vcode"));
//			} else {
//				res = service.getSql("sql", "member.total");
//				List<ConditionBean> beans = new ArrayList<ConditionBean>();
//				beans.add(new ConditionBean("uname", "=", "?", u, "m"));
//				res = (String) service.queryForObject(res, String.class, beans);
//				if(!res.equals("0")){
//					json.element("error","1");
//					json.element("msg", this.getWebProperties("web", "user.register.error.uname"));
//				} else {
//					json.element("error","3");
//					session.removeAttribute("vcode");
//					MemberInfo m = new MemberInfo();
//					m.setUname(u);
//					m.setUpass(p);
//					m.setUemail(e);
//					//默认积分  和 等级
//					m.setIntergration("0");
//					m.setLvl(1);
//					session.setAttribute("loginUser", m);
//				}
//			}
//		} catch (Exception ex) {
//			ex.printStackTrace();
//			json.element("error","2");
//			json.element("msg", this.getWebProperties("web", "msg.fail"));
//		}
//		return json.toString();
//	}

	// @RequestMapping("/adminLogin.ajax")
	// public String adminLogin(@RequestParam("u") String u, @RequestParam("p")
	// String p, HttpSession session) {
	// String res = null;
	// try {
	// res = service.getSql("sql", "member.total");
	// List<ConditionBean> beans = new ArrayList<ConditionBean>();
	// beans.add(new ConditionBean("uname", "=", "?", u, "m"));
	// beans.add(new ConditionBean("upass", "=", "?", p, "m"));
	// res = (String) service.queryForObject(res, String.class, beans, u, p);
	// } catch (AzjDbClientException e) {
	// res = this.getWebProperties("web", "adminlogin.db.error");
	// log4j.error(e);
	// } catch (AzjQueryBuilderException e) {
	// res = this.getWebProperties("web", "adminlogin.condition.error");
	// log4j.error(e);
	// }
	// return (res == null) ? this.getWebProperties("web",
	// "adminlogin.login.error") : this.getWebProperties("web","msg.success");
	// }

//	@RequestMapping("/register.form")
//	public String registerPage(HttpSession session) {
//		if (session != null) {
//			session.removeAttribute("loginUser");
//		}
//		session.invalidate();
//		return this.getWebProperties("web", "user.register.page");
//	}
//
//	@RequestMapping("/registerSendEmail.form")
//	public String registerSendEmail(@RequestParam("e") String e,@RequestParam("u") String u,HttpServletRequest req) {
//		String fromEmail = this.getWebProperties("web", "email.from");
//		String user = this.getWebProperties("web", "email.user");
//		String password = this.getWebProperties("web", "email.pws");
//		String subject = this.getWebProperties("web", "email.subject");
//		String content = this.getWebProperties("web", "email.content");
//		try {
//			ICommons email = new CommonsImpl();
//			email.SendEMail(MailClient.M163, fromEmail, user, password, subject, content, false, e);
//		} catch (AzjEmailException e1) {
//			log4j.error("Send Email Error");
////			e1.printStackTrace();
//		}
//		return this.getWebProperties("web", "user.register.emailmsg.page");
//	}
//	
//	@ResponseBody
//	@RequestMapping("/registerRepeatSendEmail.ajax")
//	public String registerRepeatSendEmail(@RequestParam("e") String e,@RequestParam("u") String u) {
//		String fromEmail = this.getWebProperties("web", "email.service");
//		String user = this.getWebProperties("web", "email.user");
//		String password = this.getWebProperties("web", "email.pws");
//		String subject = this.getWebProperties("web", "email.subject");
//		String content = this.getWebProperties("web", "email.content");
//		String res = "0";
//		try {
//			ICommons email = new CommonsImpl();
//			email.SendEMail(MailClient.M163, fromEmail, user, password, subject, content, false, e);
//		} catch (AzjEmailException e1) {
//			res = "1";
//			log4j.error("Send Email Error");
////			e1.printStackTrace();
//		}
//		return res;
//	}
//	
}
